package com.vvlive.caibao.smartcity.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.vvlive.caibao.smartcity.bean.LifeOrderMealStoreBean;

import java.util.List;

import smartcity.vvlive.caibao.com.smartc.R;

/**
 * Created by lenovo on 2015/6/29.
 * 用于生活页下边的列表
 */
public class LifeBtlistAdapter extends BaseAdapter{
    Context mContext;
    List<LifeOrderMealStoreBean> mList;

    public LifeBtlistAdapter(Context context, List<LifeOrderMealStoreBean> mList) {
        mContext = context;
        this.mList = mList;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder vh;
        if(convertView == null){
            convertView = LayoutInflater.from(mContext).inflate(R.layout.life_item_yijuhua_list,null);
            vh = new ViewHolder();
            vh.mTextView = (TextView) convertView.findViewById(R.id.life_yijuhua);
            convertView.setTag(vh);
        }else{
            vh = (ViewHolder) convertView.getTag();
        }
        vh.mTextView.setText(mList.get(position).getName());
        return convertView;
    }
    class ViewHolder{
        TextView mTextView;
    }
}
